package com.example.behaviour.pojos;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

@Data
@Document("comment")
public class CommentDto {

    private static final long serialVersionUID = 1L;

    @Id
    private String id;//主键
    //该属性对应mongodb的字段的名字，如果一致，则无需该注解
    //@Field("content")
    private String content;//吐槽内容

    @TableField(exist = false)
    private Date publishTime;//发布日期
    //添加了一个单字段的索引
    //@Indexed
    private String userId;//发布人ID

    private String nickname;//昵称

//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String createdTime;//评论的日期时间

    private Integer likeNum;//点赞数

    private Integer replyNum;//回复数

    private String state;//状态

    private String parentId;//上级ID

    private String articleId;

    @TableField(exist = false)
    private boolean isLiked;

    @TableField(exist = false)
    private List<Comment> childComment;
}
